package com.structs;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;

public class LoginAction extends DispatchAction {

	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
		com.structs.ActionForm actionform = (com.structs.ActionForm) form;
		String username = actionform.getUsername();
		String passwd = actionform.getPasswd();
		System.out.println(passwd);
		if ("admin".equals(username) && "123".equals(passwd)) {

			return mapping.findForward("success");
		} else {
			return mapping.findForward("error");
		}

	}

}
